package cn.com.huzo.repository.manufacture.impl;

import cn.com.huzo.model.entities.manufacture.CmtSettlementSlipHeaderEntity;
import cn.com.huzo.model.entities.manufacture.CmtSettlementSlipLinesEntity;
import huzofw.repository.impl.GenericRepositoryImpl;
import huzofw.repository.impl.MyBatisDaoUtils;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import cn.com.huzo.repository.manufacture.CmtSettlementSlipLinesRepository;

/**
 * 加工费计算明细数据访问对象。
 *
 * @author 吴旭
 */
@Repository("CmtSettlementSlipLinesRepository")
public class CmtStatementsLinesRepositoryImpl extends GenericRepositoryImpl<CmtSettlementSlipLinesEntity, String>
        implements CmtSettlementSlipLinesRepository {

    private final String namespace = "cn.com.huzo.repository.manufacture.CmtSettlementSlipLinesRepository";

    /**
     * 构造函数,设置the instance to ProductRepositoryImpl.class.
     */
    public CmtStatementsLinesRepositoryImpl() {
        super(CmtSettlementSlipLinesEntity.class);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<CmtSettlementSlipLinesEntity> fetchByHeaderId(Long headerId) {
        return getSqlSession().selectList(MyBatisDaoUtils.getMapperQueryId(
                namespace, "fetchByHeaderId"), headerId);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer insertLinesByNormal(CmtSettlementSlipHeaderEntity instance) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "insertLinesByNormal"), instance);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer insertLinesByHandCut(Map<String, Object> criterion) {
        return getSqlSession().insert(MyBatisDaoUtils.getMapperQueryId(
                namespace, "insertLinesByHandCut"), criterion);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer batchUpdate(List<CmtSettlementSlipLinesEntity> itemList) {
        return getSqlSession().update(MyBatisDaoUtils.getMapperQueryId(
                namespace, "batchUpdate"), itemList);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer delete(String key) {
        return getSqlSession().delete(MyBatisDaoUtils.getMapperQueryId(
                namespace, "delete"), key);
    }
}
